Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rework to be proper abstraction of a SecretStore and add SecretStoreClient from edgex-go #91

Merged
merged 5 commits into from
Feb 19, 2021

Conversation

lenny-goodell
Copy link
Member

@lenny-goodell lenny-goodell commented Feb 18, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #87

What is the new behavior?

No longer leak that Vault is the only implementation
Added Type to the configuration and factory method, so it will error if not set
Move SecretStoreClient from edgex-go in to this abstraction and added the EnableConsulSecretEngine interface needed for Secure Consul
Now have to interfaces that the vault wrapper implements, which are SecretsClient & SecretStoreClient

SecretStoreClient code originated from here: https://github.com/edgexfoundry/edgex-go/tree/master/internal/security/secretstoreclient.

Does this PR introduce a breaking change?

  • Yes
  • No

BREAKING CHANGE: All existing SecretStore configuration must add Type = 'vault'

Are there any new imports or modules? If so, what are they used for and why?

no

Are there any specific instructions or things that should be known prior to reviewing?

Other information

@lenny-goodell lenny-goodell changed the title refactor: Refactor to be proper abstraction of a SecretStore refactor: Rework to be proper abstraction of a SecretStore and add SecretStoreClient from edgex-go Feb 18, 2021
No longer leak that Vault is the only implementation
Added `Type` to the configuration and factory method, so it will error if not set
Move SecretStoreClient from edgex-go in to this abstraction and added the `EnableConsulSecretEngine` interface needed for `Secure Consul`
Now have to interfaces that the vault wrapper implements, which are SecretsClient & SecretStoreClient

closes #87

BREAKING CHANGE: All existing SecretStore configuration must add `Type = 'vault'`

Signed-off-by: lenny <[email protected]>
Copy link
Contributor

@jim-wang-intel jim-wang-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Some suggestions to change. Also, I've created secretengine.enabler like factory method to be hooked with secretstore-setup, should that part be in here or you prefer to leave it to the edgex-go level?

@lenny-goodell
Copy link
Member Author

I've created secretengine.enabler like factory method to be hooked with secretstore-setup, should that part be in here or you prefer to leave it to the edgex-go level?

@jim-wang-intel , I don't understand the need for it, but it doesn't belong in this abstraction. So if really needed, then stays in edgex-go.

@jim-wang-intel
Copy link
Contributor

I've created secretengine.enabler like factory method to be hooked with secretstore-setup, should that part be in here or you prefer to leave it to the edgex-go level?

@jim-wang-intel , I don't understand the need for it, but it doesn't belong in this abstraction. So if really needed, then stays in edgex-go.

Ok, I'll leave it at edgex-go level, thanks!

@codecov-io
Copy link

codecov-io commented Feb 19, 2021

Codecov Report

Merging #91 (3449eae) into master (f21943c) will increase coverage by 21.01%.
The diff coverage is 82.23%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #91       +/-   ##
===========================================
+ Coverage   59.31%   80.32%   +21.01%     
===========================================
  Files           8       16        +8     
  Lines         349      742      +393     
===========================================
+ Hits          207      596      +389     
+ Misses        131      101       -30     
- Partials       11       45       +34     
Impacted Files Coverage Δ
internal/pkg/vault/errors.go 0.00% <ø> (ø)
internal/pkg/vault/request.go 56.25% <56.25%> (ø)
internal/pkg/vault/roottoken.go 67.90% <67.90%> (ø)
internal/pkg/vault/client.go 70.58% <70.58%> (ø)
pkg/requestor.go 72.00% <72.00%> (ø)
internal/pkg/vault/mock.go 72.50% <72.50%> (ø)
pkg/types/config.go 82.35% <84.61%> (-5.15%) ⬇️
internal/pkg/vault/secrets.go 74.27% <85.43%> (ø)
internal/pkg/vault/management.go 94.01% <94.01%> (ø)
internal/pkg/vault/token.go 97.29% <97.29%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f21943c...3449eae. Read the comment docs.

Copy link
Contributor

@jim-wang-intel jim-wang-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very close: a couple of suggestions and typo change.

Copy link
Contributor

@jim-wang-intel jim-wang-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lenny-goodell
Copy link
Member Author

recheck

@lenny-goodell lenny-goodell merged commit 652b40c into edgexfoundry:master Feb 19, 2021
@lenny-goodell lenny-goodell deleted the management-client branch February 19, 2021 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module: Refactor SecrectStoreClient from edgex-go to SecretStoreManagementClient in go-mod-secrets
4 participants